package common.data.sysmanager {
	import common.model.WqCompanyInfo;
	import common.model.WqDepInfo;
	import common.model.WqMapRegion;
	import common.model.WqRouteAssign;
	import common.model.WqStaffInfo;
	import common.model.WqUserInfo;
	
	import flash.utils.ByteArray;
	
	import mx.collections.ArrayCollection;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.remoting.RemoteObject;

	public class RouteService extends RemoteObject{
		
		public var findAllRouteCallBack:Function;
		public var deleteRouteCallBack:Function;
		public var saveOrUpdateRouteCallBack:Function;
		
		
		public var findRouteAssignByRouteIdCallBack:Function;
		public var findRouteAssignByStaffIdCallBack:Function;
		public var saveOrUpdateRouteAssignCallBack:Function;
		public var deleteRouteAssignCallBack:Function;
		public var batchSaveRouteAssignCallBack:Function;
		
		public function RouteService() {
			super("routeService");
			this.showBusyCursor = true;
			
			this.getOperation("findAllRoute").addEventListener(ResultEvent.RESULT,findAllRouteResult,false,0,true);
			this.getOperation("deleteRoute").addEventListener(ResultEvent.RESULT,deleteRouteResult,false,0,true);
			this.getOperation("saveOrUpdateRoute").addEventListener(ResultEvent.RESULT,saveOrUpdateRouteResult,false,0,true);
			
			
			this.getOperation("findRouteAssignByRouteId").addEventListener(ResultEvent.RESULT,findRouteAssignByRouteIdResult,false,0,true);
			this.getOperation("findRouteAssignByStaffId").addEventListener(ResultEvent.RESULT,findRouteAssignByStaffIdResult,false,0,true);
			this.getOperation("saveOrUpdateRouteAssign").addEventListener(ResultEvent.RESULT,saveOrUpdateRouteAssignResult,false,0,true);
			this.getOperation("deleteRouteAssign").addEventListener(ResultEvent.RESULT,deleteRouteAssignResult,false,0,true);
			this.getOperation("batchSaveRouteAssign").addEventListener(ResultEvent.RESULT,batchSaveRouteAssignResult,false,0,true);
		}
		
		public function findAllRoute():void{
			this.getOperation("findAllRoute").send();
		}
		public function deleteRoute(id:String):void{
			this.getOperation("deleteRoute").send(id);
		}
		public function saveOrUpdateRoute(r:WqMapRegion):void{
			this.getOperation("saveOrUpdateRoute").send(r);
		}
		
		public function findRouteAssignByRouteId(routeId:String):void{
			this.getOperation("findRouteAssignByRouteId").send(routeId);
		}
		public function findRouteAssignByStaffId(staffId:String):void{
			this.getOperation("findRouteAssignByStaffId").send(staffId);
		}
		public function saveOrUpdateRouteAssign(ra:WqRouteAssign):void{
			this.getOperation("saveOrUpdateRouteAssign").send(ra);
		}
		public function deleteRouteAssign(id:String):void{
			this.getOperation("deleteRouteAssign").send(id);
		}
		public function batchSaveRouteAssign(ra:WqRouteAssign,staffIds:Array,routeIds:Array):void{
			this.getOperation("batchSaveRouteAssign").send(ra,staffIds,routeIds);
		}
		
		
		private function findAllRouteResult(e:ResultEvent):void{
			findAllRouteCallBack.call(this,e);
		}
		private function deleteRouteResult(e:ResultEvent):void{
			deleteRouteCallBack.call(this,e);
		}
		private function saveOrUpdateRouteResult(e:ResultEvent):void{
			saveOrUpdateRouteCallBack.call(this,e);
		}
		
		private function findRouteAssignByRouteIdResult(e:ResultEvent):void{
			findRouteAssignByRouteIdCallBack.call(this,e);
		}
		private function findRouteAssignByStaffIdResult(e:ResultEvent):void{
			findRouteAssignByStaffIdCallBack.call(this,e);
		}
		private function saveOrUpdateRouteAssignResult(e:ResultEvent):void{
			saveOrUpdateRouteAssignCallBack.call(this,e);
		}
		private function deleteRouteAssignResult(e:ResultEvent):void{
			deleteRouteAssignCallBack.call(this,e);
		}
		private function batchSaveRouteAssignResult(e:ResultEvent):void{
			batchSaveRouteAssignCallBack.call(this,e);
		}
		
	}
}